public class Person {
    //私有属性
private String name;
private int age;

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public void setAge(int age) {
        this.age = age;
    }

    //构造方法
public Person(String name,int age){
    this.name=name;
    this.age=age;
}
//公共的getter方法
    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
    //公共方法
    public void introduce(){
        System.out.println("Hi,my name is"+name+"and i am"+age+"years old");
    }
    //父类特有的方法
    public void work(){
        System.out.println(name+"is working.");
    }
}
